Skip to contentSkip to conversation

Change in openvpn[master]: forward: Change context_reschedule_sec sec argument to time_t

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Nov 7, 2025 – Nov 16, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1762517501000.Id9158f477404aac1d6b08b08e672980e5a58dc35@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1356?usp=email

to review the following change.

Change subject: forward: Change context_reschedule_sec sec argument to time_t
......................................................................

forward: Change context_reschedule_sec sec argument to time_t

This avoids conversions at the caller sites. Since we only replace tv_sec if the new value is smaller the cast to tv_sec_t is also safe.

Change-Id Id9158f477404aac1d6b08b08e672980e5a58dc35

---
M src/openvpn/forward.c

1 file changed, 8 insertions(+), 7 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/1356/1

src/openvpn/forward.c +8 -7
index cffb310..fbef539 100644
@@ -33,6 +33,7 @@
 #include "mss.h"
 #include "event.h"
 #include "occ.h"
+#include "otime.h"
 #include "ping.h"
 #include "ps.h"
 #include "dhcp.h"
@@ -127,7 +128,7 @@
 }
 
 static inline void
-context_reschedule_sec(struct context *c, int sec)
+context_reschedule_sec(struct context *c, time_t sec)
 {
     if (sec < 0)
     {
@@ -135,7 +136,7 @@
     }
     if (sec < c->c2.timeval.tv_sec)
     {
-        c->c2.timeval.tv_sec = sec;
+        c->c2.timeval.tv_sec = (tv_sec_t)sec;
         c->c2.timeval.tv_usec = 0;
     }
 }
@@ -822,11 +823,6 @@
 #endif /* ENABLE_MANAGEMENT */
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static void
 check_coarse_timers(struct context *c)
 {
@@ -1297,6 +1293,11 @@
 #endif /* if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) */
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 /*
  * Output: c->c2.buf
  */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1356?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id9158f477404aac1d6b08b08e672980e5a58dc35
Gerrit-Change-Number: 1356
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1356?usp=email )

Change subject: forward: Change context_reschedule_sec sec argument to time_t
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1356?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id9158f477404aac1d6b08b08e672980e5a58dc35
Gerrit-Change-Number: 1356
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 11 Nov 2025 11:47:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 forward: Change context_reschedule_sec sec argument to time_t

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

This avoids conversions at the caller sites. Since we only replace tv_sec if the new value is smaller the cast to tv_sec_t is also safe.

Change-Id Id9158f477404aac1d6b08b08e672980e5a58dc35

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1356
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1356
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/forward.c +8 -7
index cffb310..fbef539 100644
@@ -33,6 +33,7 @@
 #include "mss.h"
 #include "event.h"
 #include "occ.h"
+#include "otime.h"
 #include "ping.h"
 #include "ps.h"
 #include "dhcp.h"
@@ -127,7 +128,7 @@
 }
 
 static inline void
-context_reschedule_sec(struct context *c, int sec)
+context_reschedule_sec(struct context *c, time_t sec)
 {
     if (sec < 0)
     {
@@ -135,7 +136,7 @@
     }
     if (sec < c->c2.timeval.tv_sec)
     {
-        c->c2.timeval.tv_sec = sec;
+        c->c2.timeval.tv_sec = (tv_sec_t)sec;
         c->c2.timeval.tv_usec = 0;
     }
 }
@@ -822,11 +823,6 @@
 #endif /* ENABLE_MANAGEMENT */
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static void
 check_coarse_timers(struct context *c)
 {
@@ -1297,6 +1293,11 @@
 #endif /* if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) */
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 /*
  * Output: c->c2.buf
  */
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: forward: Change context_reschedule_sec sec argument to time_t

Stared-at-code, and test compiled on Linux and GHA (I +2'ed this last week already, but it needed a prerequisite patch to otime.h).

Your patch has been applied to the master branch.

commit 7835c371c72b42a55a451356246733e32bdbdffa

Author: Frank Lichtenheld
Date:   Tue Nov 11 16:51:31 2025 +0100
     forward: Change context_reschedule_sec sec argument to time_t

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1356
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34319.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1356?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: forward: Change context_reschedule_sec sec argument to time_t
......................................................................

forward: Change context_reschedule_sec sec argument to time_t

This avoids conversions at the caller sites. Since we only replace tv_sec if the new value is smaller the cast to tv_sec_t is also safe.

Change-Id Id9158f477404aac1d6b08b08e672980e5a58dc35

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1356
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34319.html

---
M src/openvpn/forward.c

1 file changed, 8 insertions(+), 7 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/1356/2

src/openvpn/forward.c +8 -7
index 90e52d2..f01fb4c 100644
@@ -33,6 +33,7 @@
 #include "mss.h"
 #include "event.h"
 #include "occ.h"
+#include "otime.h"
 #include "ping.h"
 #include "ps.h"
 #include "dhcp.h"
@@ -127,7 +128,7 @@
 }
 
 static inline void
-context_reschedule_sec(struct context *c, int sec)
+context_reschedule_sec(struct context *c, time_t sec)
 {
     if (sec < 0)
     {
@@ -135,7 +136,7 @@
     }
     if (sec < c->c2.timeval.tv_sec)
     {
-        c->c2.timeval.tv_sec = sec;
+        c->c2.timeval.tv_sec = (tv_sec_t)sec;
         c->c2.timeval.tv_usec = 0;
     }
 }
@@ -829,11 +830,6 @@
 #endif /* ENABLE_MANAGEMENT */
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static void
 check_coarse_timers(struct context *c)
 {
@@ -1304,6 +1300,11 @@
 #endif /* if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) */
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 /*
  * Output: c->c2.buf
  */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1356?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id9158f477404aac1d6b08b08e672980e5a58dc35
Gerrit-Change-Number: 1356
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1356?usp=email )

Change subject: forward: Change context_reschedule_sec sec argument to time_t
......................................................................

forward: Change context_reschedule_sec sec argument to time_t

This avoids conversions at the caller sites. Since we only replace tv_sec if the new value is smaller the cast to tv_sec_t is also safe.

Change-Id Id9158f477404aac1d6b08b08e672980e5a58dc35

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1356
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34319.html

---
M src/openvpn/forward.c

1 file changed, 8 insertions(+), 7 deletions(-)
src/openvpn/forward.c +8 -7
index 90e52d2..f01fb4c 100644
@@ -33,6 +33,7 @@
 #include "mss.h"
 #include "event.h"
 #include "occ.h"
+#include "otime.h"
 #include "ping.h"
 #include "ps.h"
 #include "dhcp.h"
@@ -127,7 +128,7 @@
 }
 
 static inline void
-context_reschedule_sec(struct context *c, int sec)
+context_reschedule_sec(struct context *c, time_t sec)
 {
     if (sec < 0)
     {
@@ -135,7 +136,7 @@
     }
     if (sec < c->c2.timeval.tv_sec)
     {
-        c->c2.timeval.tv_sec = sec;
+        c->c2.timeval.tv_sec = (tv_sec_t)sec;
         c->c2.timeval.tv_usec = 0;
     }
 }
@@ -829,11 +830,6 @@
 #endif /* ENABLE_MANAGEMENT */
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static void
 check_coarse_timers(struct context *c)
 {
@@ -1304,6 +1300,11 @@
 #endif /* if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) */
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 /*
  * Output: c->c2.buf
  */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1356?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id9158f477404aac1d6b08b08e672980e5a58dc35
Gerrit-Change-Number: 1356
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>